import { findAllWire, addWire, delWire } from '@/apis/wireAPI'
import { ref } from 'vue'

export default () => {
  const res = ref<ResponseModel<WireModel>>()
  const wires = ref<WireModel[]>()

  async function all(args = {}) {
    const { data } = await findAllWire(args)
    res.value = data
  }

  async function findallNoPage() {
    const { data } = await findAllWire({})
    wires.value = data.data
  }

  async function add(data: WireModel) {
    return await addWire(data)
  }

  async function del(id: number) {
    return await delWire(id)
  }

  return { add, all, findallNoPage, del, res, wires }
}
